﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace SVAP
{
    public partial class PictureForm : Form
    {
        internal string filePath = "";    //记录图片的地址
        internal bool isConfigure;        //标志位，表示是否已经配置过

        public PictureForm()
        {
            InitializeComponent();

            //将该窗口设置为程序的焦点，且不允许改变，直至关闭该窗口
            SetWindow setWin = new SetWindow(this.Handle);
            setWin.Star();

            //置标志位
            isConfigure = false;
        }

        //关闭图片分析窗体
        private void btn_exit_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        //查看图片
        private void btn_viewPicture_Click(object sender, EventArgs e)
        {
            //MainForm mf = new MainForm();
            //mf = (MainForm)this.Owner;

            //if (mf.filePath != "")
            //{
            //    try
            //    {
            //        System.Diagnostics.Process.Start(mf.filePath);
            //    }
            //    catch (Exception viewPictureError)
            //    {
            //        MessageBox.Show("无法打开图片！");
            //    }
            //}
            //else
            //    MessageBox.Show("请选择图片！");

            if (this.filePath != "")
            {
                try
                {
                    System.Diagnostics.Process.Start(this.filePath);
                }
                catch (Exception viewPictureError)
                {
                    MessageBox.Show("无法打开图片！");
                }
            }
            else
                MessageBox.Show("请选择图片！");
        }

        //配置
        private void btn_config_Click(object sender, EventArgs e)
        {
            ConfigAlgorithmForm caf = new ConfigAlgorithmForm();
            caf.Owner = this;
            caf.Show();
        }

        //开始分析
        private void btn_analysis_Click(object sender, EventArgs e)
        {
            if (isConfigure == true)
            { 
            }
            else
                MessageBox.Show("请先配置算法和输出结果，再开始分析。");
        }

        private void PictureForm_Load(object sender, EventArgs e)
        {

        }
    }
}
